<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    //  对象的取值器 和 赋值器
    const obj = {
      xxx: 18,

      get age() {
        console.log('get读取触发  ----->  ',);
        return this.xxx
      },

      set age(value) {
        console.log('set触发  ----->  ',);
        this.xxx = value
      }
    };


    // // 读取
    // console.log('obj.age  ----->  ', obj.age);

    // // 赋值
    obj.age = 19

    // console.log('obj.age  ----->  ', obj.age);

  </script>
</body>

</html>